<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>vue学习</title>
    <script src="./js/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <h3>{{username}}</h3>
      <!-- <input type="text" :value="username" @input="setUsername" /> -->
      <!-- 
        v-model它是一个 value/input checked/change 简写  语法糖
       -->
      <input type="text" v-model="username" />
      <br />
      <!-- <input type="checkbox" :checked="checked" @change="changeHandle" /> -->
      <input type="checkbox" v-model="checked" />
    </div>
    <script>
      const app = Vue.createApp({
        data() {
          return {
            username: '',
            // 单个复选框数据类型设置为boolean
            checked: true
          }
        },
        methods: {
          // setUsername(e) {
          //   this.username = e.target.value
          // },
          // changeHandle(e) {
          //   this.checked = e.target.checked
          // }
        }
      })
      app.mount('#app')
    </script>
  </body>
</html>
